import Base from './base'
const api = new Base()

export const addGoods = (data: any) => api.post('/goods', data)
export const updateGoods = (data: any) => api.post(`/goods/${data.id}`, data)
export const delGoods = (id: string) => api.delete(`/goods/${id}`)
export const getGoodsList = (data: any) => api.get('/goods/page', data)
export const getGoods = (id: string) => api.get(`/goods/${id}`)
export const getCategoryList = () => api.get('/goodsCategory/list')

export const addCollect = (goodsId: string) => api.post(`/goodsCollect/collect/${goodsId}`)
export const delCollect = (goodsId: string) => api.post(`/goodsCollect/cancelCollect/${goodsId}`)
export const getCollectList = () => api.get('/goodsCollect/page')
export const getCollectByUser = () => api.get(`/goodsCollect/myPage`)


export const addPrize = (goodsId: string) => api.post(`/goodsPrize/${goodsId}`)
export const delPrize = (goodsId: string) => api.post(`/goodsPrize/cancel/${goodsId}`)


export const addComment = (data: any) => api.post('/goodsComment/comment', data)


export const getComments = (data: any) => api.get('/goodsComment/page', data)
export const delComments = (id: string) => api.delete(`/goodsComment/delete/${id}`)
